const jsonwebtoken = require("jsonwebtoken");
const { expressjwt } = require("express-jwt");
const secret = "shitouren";
const JWT = {
  generate: (value, expires) => {
    return jsonwebtoken.sign(value, secret, { expiresIn: expires });
  },
  verify: expressjwt({
    secret,
    algorithms: ["HS256"],
  }).unless({
    path: [/^\/api\//],
  }),
};

module.exports = JWT;
